package com.mc.lp.database.entity.type;
/**
 * defines record type in system
 * @author deepak
 *
 */
public enum RecordType {
	NONE(-1L),
	ACADEMICS(1L),
	EXTRA_ACADEMICS(2L),
	SPORTS(3L),
	SOCIAL_BHEAVIOUR(4L),
	MEMORIES(5L),
	HEALTH_RECORD(6L),
	PROFILE_PIC(7L);
	
	private Long id;   
	 
    private RecordType(Long id) {
        this.id = id;
    }
 
    
    public static RecordType getType(Long id) {
       
        if (id == null) {
            return null;
        }
 
        for (RecordType recordType : RecordType.values()) {
            if (id.equals(recordType.getId())) {
                return recordType;
            }
        }
        throw new IllegalArgumentException("No matching type for id " + id);
    }
    
    public static RecordType getType(String name) {
    	if(null == name){
    		throw new IllegalArgumentException("No matching type for name " + name);
    	}
    	return RecordType.valueOf(name);
    }
    
    public static Long getId(String name) {
    	if(null == name){
    		throw new IllegalArgumentException("No matching type for name " + name);
    	}
    	return RecordType.valueOf(name).getId();
    }
 
    public Long getId() {
        return id;
    }
}
